/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2025-02-12
 * Time: 22:48
 */

public class YouthAccount extends BankAccount {
    // Additional attribute for the withdrawal limit (in cents).
    private int limit;

    // Constructor: accepts the IBAN and the withdrawal limit.
    public YouthAccount(String iban, int limit) {
        super(iban);
        this.limit = limit;
    }

    // Override the withdraw method to take the limit into account.
    @Override
    public void withdraw(int amount) {
        // Check if the withdrawal amount exceeds the set limit.
        if (amount > limit) {
            System.out.println("Auszahlung abgebrochen. Limit überschritten.");
            return;
        }
        // Otherwise, proceed with the withdrawal using the parent method.
        super.withdraw(amount);

    }
}
